<template>
    <ul class="courseList" v-if="!isBuy">
        <li v-for="item, index in courseList" :key="index"><a :href="href + '?id=' + item.id" class="clearfloat"
                target="_blank"><img :src="item.showImage" :alt="item.productName"
                    onerror="this.src='/src/assets/images/logo3.png'" class="fl"> <span class="courseInfo fr"><span
                        class="courseTitle">{{ item.productName }}</span> <span class="courseSubTitle">{{ item.subtitle
                        }}</span> <span class="priceWrap"><span class="unit">￥</span><span class="price">{{ item.minPrice
}}</span> <span class="textQi">起</span>
                    </span></span></a></li>

    </ul>
    <ul class="courseList" v-else>
        <li v-for="item, index in courseList" :key="index"><a class="clearfloat" target="_blank"> <span
                    class="courseInfo fr"><span class="courseTitle">{{ item.name }}</span> <span class="priceWrap">
                    </span></span></a></li>
    </ul>
</template>
<script setup>
// import { ref, reactive, onMounted, onBeforeMount, onBeforeUnmount, onUnmounted, onActivated, onDeactivated } from 'vue'

const props = defineProps({
    isBuy: {
        type: Boolean,
        default: false
    },
    courseList: {
        type: Array,
        default: []
    },
    href: {
        type: String,
        default: '#/selectCourse/detail'
    }
})


// const route= useRoute()


</script>
<style scoped>
.courseList {
    width: 1000px;
    margin: 0 auto;
    padding-top: 20px;
}



ul.courseList>li {
    padding: 20px;
    background: var(--bg_white);
    box-shadow: 0 1px 10px -2px rgba(0, 0, 0, .04);
    border-radius: 20px;
    border: 1px solid var(--gray_95);
    -webkit-transition: all .2s;
    transition: all .2s;
}

ul.courseList>li:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 20px 0 rgba(0, 0, 0, .05);
    cursor: pointer;
}

ul.courseList>li a {
    display: block;
    width: 100%;
    color: #333;
}


ul.courseList>li a img {
    width: 114px;
    height: 114px;
    border-radius: 10px;
}




ul.courseList>li a span.courseInfo {
    display: block;
    width: 780px;
    line-height: normal;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}





ul.courseList>li a span.courseInfo .courseTitle {
    color: var(--gray_20);
    font-size: 18px;
    font-weight: 600;
}

ul.courseList>li a span.courseInfo .courseSubTitle {
    font-size: 14px;
    color: var(--gray_50);
    margin-top: 10px;
}

ul.courseList>li a span.courseInfo>span {
    display: block;
}

ul.courseList>li a span.courseInfo .priceWrap {
    margin-top: 30px;
    color: var(--red_n);
    font-size: 12px;
}

ul.courseList>li a span.courseInfo .priceWrap .unit {
    font-weight: 600;
    vertical-align: -webkit-baseline-middle;
}

ul.courseList>li a span.courseInfo .priceWrap span {
    display: inline-block;
}

ul.courseList>li a span.courseInfo .priceWrap .price {
    font-size: 24px;
    font-weight: 600;
    vertical-align: middle;
}

ul.courseList>li a span.courseInfo .priceWrap .textQi {
    vertical-align: -webkit-baseline-middle;
}


ul.courseList>li+li {
    margin-top: 20px;
}

ul.courseList>li {
    padding: 20px;
    background: var(--bg_white);
    box-shadow: 0 1px 10px -2px rgba(0, 0, 0, .04);
    border-radius: 20px;
    border: 1px solid var(--gray_95);
    -webkit-transition: all .2s;
    transition: all .2s;
}
</style>